﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MenusHunter.WinRT.Core.MVVM;
using Windows.UI.Xaml.Controls;

namespace MenusHunter.WinRT.Helpers
{
    public class NavigateService:INavigateServcie
    {
        private Frame _frame;

        public NavigateService(Frame frame)
        {
            _frame = frame;
        }
        #region Implementation of INavigateServcie

        /// <summary>
        ///  determine page can go back
        /// </summary>
        public bool CanGoBack { get { return _frame.CanGoBack; } }

        /// <summary>
        ///  determine page can go forward
        /// </summary>
        public bool CanGoForward { get { return _frame.CanGoForward; } }

        /// <summary>
        /// Go to previouse page
        /// </summary>
        public void GoBack()
        {
            _frame.GoBack();
        }

        /// <summary>
        /// Go to next page
        /// </summary>
        public void GoForward()
        {
           _frame.GoForward();
        }

        /// <summary>
        /// Navigate to a page 
        /// </summary>
        /// <param name="type">Type of page class</param>
        /// <param name="parameters">data scross two pages</param>
        public bool Navigate(Type type, object parameters = null)
        {
            return _frame.Navigate(type, parameters);
        }

        #endregion
    }
}
